﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HAMath;
namespace HA.ModFlow.Controls.Windows.DataOperation
{
    /// <summary>
    /// winExperimental.xaml 的交互逻辑
    /// </summary>
    public partial class winExperimental : Window
    {
        public winExperimental( ExperimentalVariogram exper )
        {
            InitializeComponent();
            this._experimental =(ExperimentalVariogram) exper.Clone();
            this.DataContext = this.Experimental;
        }

        ExperimentalVariogram _experimental;

        public ExperimentalVariogram Experimental
        {
            get { return _experimental; }
            set { _experimental = value; }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();
        }

        private void btnCancal_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }

    public class ConvertToVariogramType : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            VariogramType type = (VariogramType)value;
            int index = 0;
            switch (type)
            {
                case VariogramType.Semivariogram:  
                    index = 0;
                    break;
                case VariogramType.Covariance:
                    index = 1;
                    break;
                case VariogramType.Correlogram:
                    index = 2;
                    break;
                case VariogramType.GeneralRelativeSemivariogram:
                    index = 3;
                    break;
                case VariogramType.PairwiseRelativeSemivariogram:
                    index = 4;
                    break;
                case VariogramType.SemivariogramOfLogarithms:
                    index = 5;
                    break;
                case VariogramType.Semirodogram:
                    index = 6;
                    break;
                case VariogramType.Semimadogram:
                    index = 7;
                    break;
            }
            return index;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            VariogramType type = VariogramType.Covariance;
            int index = (int )value;
            switch (index)
            {
                case 0:
                    type = VariogramType.Semivariogram;
                    break;
                case 1:
                    type = VariogramType.Covariance;
                    break;
                case 2:
                    type = VariogramType.Correlogram;
                    break;
                case 3:
                    type = VariogramType.GeneralRelativeSemivariogram;
                    break;
                case 4:
                    type = VariogramType.PairwiseRelativeSemivariogram;
                    break;
                case 5:
                    type = VariogramType.SemivariogramOfLogarithms;
                    break;
                case 6:
                    type = VariogramType.Semirodogram;
                    break;
                case 7:
                    type = VariogramType.Semimadogram;
                    break;
            }
            return type;
        }
    }

}
